
package com.neighbor.neighborhoodadmin.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.neighbor.neighborhoodadmin.pojo.MallProducts;
import org.apache.ibatis.annotations.Select;
import java.util.List;

/**
 * <p>
 * 积分商城商品表 Mapper 接口
 * </p>
 *
 * @author song
 * @since 2025-09-22 09:11:23
 */

public interface  IMallProductsDao extends BaseMapper<MallProducts> {

    @Select("SELECT * FROM mall_products WHERE type_id = #{typeId} AND status = 1 ORDER BY created_at DESC")
    List<MallProducts> findActiveProductsByType(Integer typeId);

    @Select("SELECT * FROM mall_products WHERE stock > 0 AND status = 1 ORDER BY points_price ASC")
    List<MallProducts> findAvailableProducts();
}
